using System.Collections.Generic;
using Verse.AI;

namespace RimWorld;

public class JobDriver_PlaceNoCostFrame : JobDriver
{
	public override bool TryMakePreToilReservations(bool errorOnFailed)
	{
		return pawn.Reserve(job.targetA, job, 1, -1, null, errorOnFailed);
	}

	protected override IEnumerable<Toil> MakeNewToils()
	{
		this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
		yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);
		yield return Toils_Goto.MoveOffTargetBlueprint(TargetIndex.A);
		yield return Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.A);
	}
}
